# Importing Data
ISRAEL<- read_excel("C:/users/Biniam/Desktop/Documents/Academic/Thesis/Analysis Folder/Excel Files/Steel/TSA.xlsx",sheet = "Sheet1", range = "Q1:Q239")

# Checking the Imported Data
View(ISRAEL)
# Creating Time Series Data
ISRAEL_ts <- ts(ISRAEL, start=c(2000,1), end=c(2018 ,12), frequency=12)
# Viewing and Checking the Created Time Series Data
ISRAEL_ts
sum(is.na(ISRAEL_ts))
library(forecast)
ISRAEL_ts <- tsclean(ISRAEL_ts)
ISRAEL_ts

# Identification: Plotting the Time Series Data
plot(ISRAEL_ts)

# Estimating the appropriate model
ISRAEL_ts_model <- auto.arima(ISRAEL_ts)
ISRAEL_ts_model

# Forecasting
options(max.print=1000000)
ISRAEL_ts_forecast <- forecast (ISRAEL_ts_model, level=c(95), h=264)
plot(ISRAEL_ts_forecast)
ISRAEL_ts_forecast             

# Exporting
write.table(ISRAEL_ts_forecast, file="/users/Biniam/Desktop/Documents/Academic/Thesis/Result Folder/TSA Results/Excel Files/From R/Steel/ISRAEL_TSA.csv", sep=",")
